package com.hsc.www;


import com.hsc.www.reSend.App;
import com.hsc.www.reSend.DelayedMessageHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

@SpringBootTest(classes = App.class)
@RunWith(SpringJUnit4ClassRunner.class)
public class DealLetter {
    @Autowired
    private RabbitTemplate template;


    @Test
    public void testRabbit() throws Exception {
        for (int i = 0; i < 1; i++) {


           // DelayedMessageHelper.setDelayedMessage(0, 3, Collections.singletonList(30));
            template.convertAndSend("", "businessQueue", UUID.randomUUID().toString());



        }
        TimeUnit.SECONDS.sleep(100000000); // 等待接收

    }




}


//docker run -d --name rabbitmq3.7.7 -p 5672:5672 -p 15672:15672    --hostname myRabbit -e RABBITMQ_DEFAULT_VHOST=my_vhost  -e RABBITMQ_DEFAULT_USER=guest -e RABBITMQ_DEFAULT_PASS=guest df80af9ca0c9